package com.sdb.stats.controller;


import com.sdb.stats.domain.Departstats;
import com.sdb.stats.domain.Docterstats;
import com.sdb.stats.domain.Todaystats;
import com.sdb.stats.service.StatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/stats")
public class StatsController {

    @Autowired
    private StatsService statsService;

    @GetMapping("/today-stats")
    public ResponseEntity<Map<String, Integer>> getTodayStats() {
        Todaystats dto = statsService.getTodayStats();
        Map<String, Integer> stats = new HashMap<>();
        stats.put("register", dto.getRegister());
        stats.put("cancel", dto.getCancel());
        stats.put("consultation", dto.getConsultation());
        return ResponseEntity.ok(stats);
    }

    @GetMapping("/dept-stats")
    public ResponseEntity<List<Departstats>> getDeptStats() {
        List<Departstats> stats = statsService.getDeptStats();
        return ResponseEntity.ok(stats);
    }

    @GetMapping("/doctor-stats")
    public ResponseEntity<List<Docterstats>> getDoctorStats() {
        return ResponseEntity.ok(statsService.getDocterStats());
    }

//    @GetMapping("/medicine-stats")
//    public ResponseEntity<List<MedicineStat>> getMedicineStats() {
//        return ResponseEntity.ok(statsService.getMedicineStatistics());
//    }
}
